

    var submitParam = sessionStorage.getItem('submitParam') || {};//存放所有的提交数据

    //添加一条记录
    $(".add_btn").click(function () {
        var curNum = $(this).prev().children('li').length;
        var liItem = $(this).prev().children('li').eq(curNum-1).clone();
        liItem.find('.item_num').html(parseInt(curNum)+1);
        if(liItem.find('.deleteItem').length == 0){
            liItem.append('<div class="deleteItem">删除</div>');
        }
        $(this).prev().find('.deleteItem').hide();
        $(this).prev().append(liItem);
    })
    //删除上一条记录
    $(".item_box").on('click','.deleteItem',function(){
        $(this).parents('li').prev('li').find('.deleteItem').show();
        $(this).parents('li').remove();
    });

    //获取填写数据
    function getDomData(father,ulId,nameArr) {
        var fatherParam = submitParam.father || {};
        var list = $("#"+ulId+" li");
        fatherParam[ulId] = [];
        $.each(list,function (index,param) {
            var thisParam = {};
            for(var i = 0; i<nameArr.length; i++){
                if($(param).find('.'+nameArr[i]).val() == '' && nameArr[i] != 'remark'){
                    continue;
                }
                if(nameArr[i] == 'termSelect'){
                    thisParam['schoolYear'] = termYear[$(param).find('.termSelect').val()].year;
                    thisParam['semesterEnum'] = termYear[$(param).find('.termSelect').val()].term;
                }else{
                    thisParam[nameArr[i]] = $(param).find('.'+nameArr[i]).val();
                }
            }
            fatherParam[ulId].push(thisParam);
        })
        if(submitParam[father]){
            submitParam[father][ulId] = fatherParam[ulId];
        }else{
            submitParam[father] = fatherParam;
        }
        localStorage.setItem('submitParam',JSON.stringify(submitParam));
        localStorage.setItem('userId',sessionStorage.getItem('userId'));
    }


